<template>
  <div style="padding:20px">
    <el-row :gutter="30">
      <el-form ref="elForm" :model="formData" :rules="rules" size="mini" label-width="85px"
        label-position="left">
        <el-col :span="12">
          <el-form-item label-width="-1px" label="客户" prop="client">
            <el-input v-model="formData.client" placeholder="请输入客户" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label-width="-1px" label="手机号码" prop="phone">
            <el-input v-model="formData.phone" placeholder="请输入手机号码" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label-width="-1px" label="客户类型" prop="type">
            <el-input v-model="formData.type" placeholder="请输入客户类型" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label-width="-1px" label="身份证号" prop="cardnum">
            <el-input v-model="formData.cardnum" placeholder="请输入身份证号" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="身份特征" prop="typeinfo">
            <el-checkbox-group v-model="formData.typeinfo" :min="1" size="medium">
              <el-checkbox v-for="(item, index) in typeinfoOptions" :key="index" :label="item.value"
                :disabled="item.disabled">{{item.label}}</el-checkbox>
            </el-checkbox-group>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label-width="-1px" label="主要负责人" prop="field110">
            <el-input v-model="formData.field110" placeholder="请输入主要负责人" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label-width="-1px" label="业务联系人" prop="field111">
            <el-input v-model="formData.field111" placeholder="请输入业务联系人" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label-width="-1px" label="邮箱" prop="field112">
            <el-input v-model="formData.field112" placeholder="请输入邮箱" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label-width="-1px" label="职务" prop="field113">
            <el-input v-model="formData.field113" placeholder="请输入职务" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label-width="-1px" label="地区影响力" prop="field114">
            <el-input v-model="formData.field114" placeholder="请输入地区影响力" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label-width="-1px" label="固定电话" prop="field115">
            <el-input v-model="formData.field115" placeholder="请输入固定电话" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label-width="-1px" label="所属地区" prop="field117">
            <el-select v-model="formData.field117" placeholder="请选择所属省" clearable :style="{width: '100%'}">
              <el-option v-for="(item, index) in field117Options" :key="index" :label="item.label"
                :value="item.value" :disabled="item.disabled"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label-width="-1px" label="客户状态" prop="field120">
            <el-input v-model="formData.field120" placeholder="请输入客户状态" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label-width="-1px" label="" prop="field121">
            <el-select v-model="formData.field121" placeholder="请选择市" clearable :style="{width: '100%'}">
              <el-option v-for="(item, index) in field121Options" :key="index" :label="item.label"
                :value="item.value" :disabled="item.disabled"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-row gutter="12">
          </el-row>
        </el-col>
        <el-col :span="12">
          <el-form-item label-width="-1px" label="法定代表人" prop="field125">
            <el-input v-model="formData.field125" placeholder="请输入法定代表人" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label-width="-1px" label="法人联系方式" prop="field126">
            <el-input v-model="formData.field126" placeholder="请输入法人联系方式" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-row gutter="25">
          </el-row>
        </el-col>
        <el-col :span="12">
          <el-form-item label-width="-1px" label="名族" prop="field129">
            <el-input v-model="formData.field129" placeholder="请输入名族" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-row gutter="30">
            <el-col :span="12">
              <el-row gutter="30">
              </el-row>
            </el-col>
          </el-row>
        </el-col>
        <el-col :span="12">
          <el-form-item label="上传" prop="field143">
            <el-upload ref="field143" :file-list="field143fileList" :action="field143Action"
              :before-upload="field143BeforeUpload">
              <el-button size="small" type="primary" icon="el-icon-upload">点击上传</el-button>
            </el-upload>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label-width="-1px" label="性别" prop="field132">
            <el-input v-model="formData.field132" placeholder="请输入性别" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label-width="-1px" label="出生日期" prop="field139">
            <el-date-picker v-model="formData.field139" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
              :style="{width: '100%'}" placeholder="请选择出生日期" clearable></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="详细地址" prop="field140">
            <el-input v-model="formData.field140" placeholder="请输入详细地址" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label-width="-1px" label="备注" prop="field141">
            <el-input v-model="formData.field141" type="textarea" placeholder="请输入备注"
              :autosize="{minRows: 4, maxRows: 4}" :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label-width="-1px" label="" prop="field142">
            <el-button type="primary" icon="el-icon-search" size="medium"> 主要按钮 </el-button>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item size="large">
            <el-button type="primary" @click="submitForm">提交</el-button>
            <el-button @click="resetForm">重置</el-button>
          </el-form-item>
        </el-col>
      </el-form>
    </el-row>
  </div>
</template>
<script>
export default {
  components: {},
  props: [],
  data() {
    return {
      formData: {
        client: undefined,
        phone: undefined,
        type: undefined,
        cardnum: undefined,
        typeinfo: [],
        field110: undefined,
        field111: undefined,
        field112: undefined,
        field113: undefined,
        field114: undefined,
        field115: undefined,
        field117: undefined,
        field120: undefined,
        field121: undefined,
        field125: undefined,
        field126: undefined,
        field129: undefined,
        field143: null,
        field132: undefined,
        field139: null,
        field140: undefined,
        field141: undefined,
        field142: undefined,
      },
      rules: {
        client: [{
          required: true,
          message: '请输入客户',
          trigger: 'blur'
        }],
        phone: [{
          required: true,
          message: '请输入手机号码',
          trigger: 'blur'
        }],
        type: [{
          required: true,
          message: '请输入客户类型',
          trigger: 'blur'
        }],
        cardnum: [{
          required: true,
          message: '请输入身份证号',
          trigger: 'blur'
        }],
        typeinfo: [{
          required: true,
          type: 'array',
          message: '请至少选择一个typeinfo',
          trigger: 'change'
        }],
        field110: [],
        field111: [],
        field112: [],
        field113: [],
        field114: [],
        field115: [],
        field117: [],
        field120: [],
        field121: [],
        field125: [],
        field126: [],
        field129: [],
        field132: [],
        field139: [],
        field140: [],
        field141: [],
      },
      field143Action: 'https://jsonplaceholder.typicode.com/posts/',
      field143fileList: [],
      typeinfoOptions: [{
        "label": "妇女",
        "value": 1
      }, {
        "label": "未成年人",
        "value": 2
      }, {
        "label": "残疾人",
        "value": ""
      }, {
        "label": "老年人",
        "value": ""
      }, {
        "label": "农民",
        "value": ""
      }, {
        "label": "农民工",
        "value": ""
      }, {
        "label": "下岗职工",
        "value": ""
      }, {
        "label": "城市居民",
        "value": ""
      }, {
        "label": "外来人员",
        "value": ""
      }],
      field117Options: [{
        "label": "选项一",
        "value": 1
      }, {
        "label": "选项二",
        "value": 2
      }],
      field121Options: [{
        "label": "选项一",
        "value": 1
      }, {
        "label": "选项二",
        "value": 2
      }],
    }
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    submitForm() {
      this.$refs['elForm'].validate(valid => {
        if (!valid) return
        // TODO 提交表单
      })
    },
    resetForm() {
      this.$refs['elForm'].resetFields()
    },
    field143BeforeUpload(file) {
      let isRightSize = file.size / 1024 / 1024 < 2
      if (!isRightSize) {
        this.$message.error('文件大小超过 2MB')
      }
      return isRightSize
    },
  }
}

</script>
<style>
.el-upload__tip {
  line-height: 1.2;
}

</style>
